package cn.myplus.examples.springbootdocs.controller;

import cn.myplus.examples.springbootdocs.dto.User;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/user")
public class UserController {

    @GetMapping("/{userId}")
    public User getUserById(@PathVariable String userId) throws Exception {
        if ("admin123".equals(userId)){
            User user =new User();
            user.setUserId("admin123");
            user.setUserName("系统管理员123");
            return user;
        }
        User user =new User();
        user.setUserId("admin");
        user.setUserName("系统管理员");
        return user;
    }
}
